﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using LY.Entity;
using LY.Entity.Entities;
using LY.Entity.PageSearch;
using LY.Entity.SearchEntity;
using LY.Entity.Jsons;


namespace LY.Interface
{

    /// <summary>
    /// 众筹项目接口
    /// </summary>
    public interface IProjectService
    {
        /// <summary>
        ///判断当前项目是否属于当前用户
        /// </summary>
        /// <param name="pid">项目ID</param>
        /// <param name="uid">用户ID</param>
        /// <returns></returns>
        bool IsProjectOwnedUser(int pid, int uid);

        #region 众筹项目分类
        /// <summary>
        /// 众筹分类查询
        /// </summary>
        /// <param name="view"></param>
        /// <returns></returns>
        PagedList<R_ProjectClass> QueryProjectClass(PageView view);
        /// <summary>
        /// 获取全部分类
        /// </summary>
        /// <returns></returns>
        PagedList<R_ProjectClass> QueryAllProjectClass(PageView view);
        /// <summary>
        /// 保存
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        int SaveProjectClass(R_ProjectClass model);
        /// <summary>
        /// 删除分类
        /// </summary>
        /// <param name="id"></param>
        /// <returns></returns>
        int DeleteProjectClass(int Id);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="Id"></param>
        /// <returns></returns>
        R_ProjectClass GetModel(int Id);

        List<R_ProjectClass> GetProjectClassListModel();

        #endregion

        #region 众筹项目列表
        PagedList<ProjectEx> QueryProject(ProjectSearch search, PageView view);

        PagedList<ProjectEx> QueryMyProject(ProjectSearch search, PageView view);

        PagedList<ProjectEx> QueryProjectMyProject(ProjectSearch search, PageView view);
        //我关注的项目
        PagedList<ProjectEx> QueryProjectAttention(ProjectSearch search, PageView view);

        R_Project GetProject(int? id);

        int SaveProject(R_Project model);

        List<R_Project_EX> QueryProject_EXList(ProjectSearch search);
        PagedList<ProjectEx> QueryProject_EXList(ProjectSearch search, PageView view);

        R_Project_EX GetProject_EX(int id);

        int GetProjectCount(int memberId);

        //项目流程 
        int InsertPorjectFlow(R_ProjectFlow flow);
        IList<R_ProjectFlow> SelectPorjectFlow(int porjectid);

        #endregion

        #region 众筹回报档位
        //查询每个项目的回报档位
        PagedList<R_ProjectItem_EX> QueryProjectItem(PageView view, int projectId);

        //查询项目档位的某一项
        R_ProjectItem GetProjectItem(int id);

        //保存项目档位
        int SaveProjectItem(R_ProjectItem projectItem);



        #endregion

        #region 众筹订单
        PagedList<R_ProjectOrder_EX> QueryProjectOrder(PageView view, ProjectOrderSearch search);

        R_ProjectOrder GetProjectOrder(int id);

        int SaveProjectOrder(R_ProjectOrder projectOrder);

        //查询每个档位投资信息
        List<R_ProjectOrder_EX> QueryInvestmentByItem(int projectId);

        //查询每个项目一共筹集多少资金
        decimal GetAllAmount(int projectId);

        //查询某个项目的支持人数
        int GetOrderCount(int projectId);

        List<U_Member_EX> QueryInvestmentMember(int projectId);

        //根据SerialNumber 序列号查询出订单实体
        R_ProjectOrder GerProjectOrderBySerialNumber(string serialNumber);

        //修改订单状态
        int UpdateOrderPayStatus(int status, string orderid);
        //根据订单编号删除订单
        int DeleteOrder(string orderid);

        /// <summary>
        /// 查询某个项目下所有支付的订单
        /// </summary>
        /// <param name="projectId"></param>
        /// <param name="payStatus"></param>
        /// <returns></returns>
        List<R_ProjectOrder> QueryProjectOrderList(int projectId,int payStatus);

        #endregion

        #region 我关注的项目
        //根据当前会员ID查询与之对应的项目
        PagedList<R_Project_EX> GetProjectList(int id, PageView view);

        //查询项目档位的某一项
        // R_ProjectItem GetProjectItem(int id);

        //保存项目档位
        //int SaveProjectItem(R_ProjectItem projectItem);
        #endregion

        #region 项目扩展
        R_ProjectExpand QueryProjectExpand(int projectid);
        R_ProjectExpand SaveProjectExpand(int projectid, int type);
        //取消关注，人数减1
        R_ProjectExpand CancelProjectExpand(int projectid);
        #endregion

        #region 项目时间轴
        int SaveProjectDatelinetree(R_ProjectDatelinetree model);
        IList<R_ProjectDatelinetree> QueryProjectDatelinetree(int projectid);
        R_ProjectDatelinetree GetProjectDatelinetree(int Id);
        #endregion

        #region 项目提问[提问人+发起人]
        //***提问人***//
        //提交问题
        int SubmitQuestion(R_projectQuestion project);

        //获取我的问题列表
        List<R_ProjectQuestion_EX> GetMyQuestionList(string mid, string pid);

        //获取公开问题列表
        List<R_ProjectQuestion_EX> GetQuestionList(string pid);

        //***发起人***//
        //发起人问题管理列表
        PagedList<R_ProjectQuestion_EX> QuestionManagement(PageView view, string id);

        //获取发起人问题详细列表
        List<R_ProjectQuestion_EX> GetQuestionList(string id, string mid);

        //获取问题Id（提问者是否存在）：用来问题回复的判断
        int GetQIdByMemberId(string mid, int? type);

        //发起人回复问题
        int ReplyQuestion(R_ProjectQuestion_EX pq);

        //删除问题及回复
        int DeleteQuestion(string mid, string pid);

        //删除已经保存的项目
        int DeleteSaveProject(int id);
        //采纳问题
        //int AdoptQuestion(string id);

        #endregion

        #region 我支持的项目
        PagedList<ProjectEx> QueryBoughtProject(ProjectSearch search, PageView view);
        #endregion

        #region 支持人列表
        PagedList<U_Member_EX> QueryInvestmentMemberList(PageView view, int projectId);
        #endregion

        #region 确认收货
        int ConfirmOrder(string id);
        #endregion

        #region 猜你喜欢
        List<R_Project_EX> CainiXihuang();
        #endregion

        #region 获取众筹投资人数,金额 和项目总数

        ProjectItem GetProjectItem();
        #endregion

        //热门众筹 
        PagedList<ProjectEx> QueryHotProject(ProjectSearch search, PageView view);

        List<ProjectEx> QueryHotProject();

        #region 首页数据统计 项目总数，注册人数，累计投资
        Change.Index GetIndexStatics();
        #endregion

    }
}
